$(document).ready(function () {

    var pageSize = parseInt($('#pagination-demo').attr("page-size"));
    var pageNo = parseInt($('#pagination-demo').attr("cur-page"))

    $('#pagination-demo').twbsPagination({
        totalPages: pageSize,
        visiblePages: pageSize < 5 ? pageSize : 5,
        startPage: pageNo,
        first: '<<',
        prev: '<',
        next: '>',
        last: '>>',
        version: '1.1',
        onPageClick: function (event, page) {
            var baseUrl = $("#pagination-demo").attr("base-url");
            if (page != pageNo) {
                window.location.href = baseUrl + '?pageNo=' + page;
            }
        }
    });

});